import * as Goods from '@/constant/goods'

const util = {
  isBlank: str => {
    if (str == null) {
      return true;
    }
    if (str.replace(/(^\s*)|(\s*$)/g, '').length == 0) {
      return true;
    }
    return false;
  },
  isEmpty: obj => {
    for (var name in obj) {
      return false;
    }
    return true;
  },
  checkMobile: mobile => {
    var reg = /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/
    return reg.test(mobile)
  },
  getSku: sku => {
    var array = Goods.tea
    for (var i = 0; i < array.length; i++) {
      if (array[i].sku === sku) {
        return array[i]
      }
    }
  },
  getDetail: sku => {
    return Goods.imgText[sku]
  }
}
export default util




// WEBPACK FOOTER //
// ./src/tools/utils.js